function findProc {
	for ((i=0; i<${#res[@]}; i+=3)); do
		if [ ${res[$i]} -eq "$1" ]; then
			parent=${res[$(($i+1))]}
			echo -e "$1\t${res[$(($i+2))]}\t$parent"
			return #unique PID
		fi
	done
	return 1 #not found
}
res=(`ps -eo pid= -o ppid= -o comm=`)
#tty can be '?' which would be expanded: use "set -f" to avoid that
echo -e "pid\tcomm\tppid"
findProc "$1"
if [ ! $? ]; then
	echo Le PID "$1" ne correspond à aucun processus !
	exit 1
else
	while [ $parent -ne 0 ]; do
		findProc $parent
	done
fi
